#include "MsgDecodeResponse.h"
#include "Tree.h"
#include "Model.h"

using namespace std;

MsgDecodeResponse::MsgDecodeResponse(Tree * tree, const Model & model)
: m_model(model)
{
	m_tree = tree;
}

MsgDecodeResponse::~MsgDecodeResponse()
{
	delete m_tree;
}

string MsgDecodeResponse::Message() const
{
	string result = m_tree->GetTreeData( m_model.GetTreeFormat() );
	unsigned int header = (unsigned int)MT_DECODE_RESPONSE;
	header |= result.length() << 8;
	string message( (char *)&header, 4 );
	message += result;
	return message;
}